﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.EndItem.CApEITFindEndItemRootEnabler
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.ObjectModel;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.EndItem;

internal class CApEITFindEndItemRootEnabler : ITxCommandEnabler
{
  private bool CheckEnable()
  {
    bool flag = false;
    TxObjectList selectedEndItems = CApEITEndItemApp.GetSelectedEndItems();
    if (((Collection<ITxObject>) selectedEndItems).Count == 1)
      flag = this.IsValidSelection(((Collection<ITxObject>) selectedEndItems)[0] as ITxEndItemProvider);
    return flag;
  }

  protected bool IsValidSelection(ITxEndItemProvider obj)
  {
    bool flag = false;
    ITxEndItemBase itemRepresentation = obj.EndItemRepresentation;
    if (itemRepresentation != null && itemRepresentation.EndItemRoot != null)
      flag = true;
    return flag;
  }

  public bool Enable => this.CheckEnable();
}
